/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ucm;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import thread.Server_Thread;

/**
 *
 * @author Vitamin
 */
public class ClientQuit {

    private static ClientQuit local;
    private Socket socket;
    private BufferedReader reader;
    private PrintWriter sender;

//    public static ClientQuit getInstance(Socket tpa, BufferedReader tpb, PrintWriter tpc)
    public static ClientQuit getInstance(Server_Thread tpa)
    {
        if(local==null)
        {
            local=new ClientQuit();
            local.socket=tpa.getSocketModel().getSocket();
            local.reader=tpa.getSocketModel().getIn();
            local.sender=tpa.getSocketModel().getOut();
        }
        return local;
    }
    
    public void run()
    {
        try{
    System.out.println("Client has log off");            
//            this.reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
//            this.sender = new PrintWriter(socket.getOutputStream(), true);
            socket.close();
            reader.close();
            sender.close();
            System.out.println("Client has log off");
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }




}
